package cn.com.yang.egg;

import java.io.IOException;

import org.junit.Test;

import com.tinify.Options;
import com.tinify.Source;
import com.tinify.Tinify;

/**
 * 
 * TODO
 * @author yangyijin
 * @date 2023年2月11日-下午10:54:17
 */
public class TinifyDemo {
	 @Test
	    public void test(){
	        Tinify.setKey("hHL6YTsbwXwmVRtvrmmpj4jLpf82llf5");

	        Source source = null;
	        try {
	            source = Tinify.fromFile("F:\\学习资料\\截图类\\技术截图\\vue.png");
	            Options options = new Options()
	                    .with("method", "fit")
	                    .with("width", 150)
	                    .with("height", 100);
	            Source resized = source.resize(options);
	            resized.toFile("thumbnail.jpg");
	        } catch (IOException e) {
	            e.printStackTrace();
	        }


	    }
}
